//
//  UITextField+extension.swift
//  DiDiRecycle
//
//  Created by abb on 16/7/17.
//  Copyright © 2016年 abb. All rights reserved.
//

import UIKit
enum TextFieldType {
    case phonenum
    case password
}

extension UITextField {
    
    class func creatTextField(textFieldType textFieldType:TextFieldType) -> UITextField {
        let tf = UITextField()
        tf.textAlignment = NSTextAlignment.Left
        tf.font = UIFont.systemFontOfSize(14)
        tf.clearButtonMode = UITextFieldViewMode.WhileEditing
        tf.keyboardType = .PhonePad
        tf.backgroundColor = UIColor.clearColor()
        // 根据类型定义 占位符
        switch textFieldType {
        case .phonenum:
            tf.placeholder = "请输入你的手机号码"
        case .password:
            tf.placeholder = "验证码"
            tf.secureTextEntry = true
        default:
            break
        }
        return tf
    }
    
    class func creatTextField() -> UITextField {
        let tf = UITextField()
        tf.textAlignment = NSTextAlignment.Left
        tf.font = UIFont.systemFontOfSize(14)
        tf.clearButtonMode = UITextFieldViewMode.WhileEditing
        tf.keyboardType = .PhonePad
        tf.backgroundColor = UIColor.clearColor()
        // 根据类型定义 占位符
//        switch textFieldType {
//        case .phonenum:
//            tf.placeholder = "请输入你的手机号码"
//        case .password:
//            tf.placeholder = "验证码"
//            tf.secureTextEntry = true
//        default:
//            break
//        }
        return tf
    }
    
    
}
